#include "Task.h"

namespace tasksystem
{
	Task::Task() :
		_state(Ready)
	{

	}

	Task::~Task()
	{

	}

	void Task::onStart()
	{

	}

	void Task::onUpdate( float dt )
	{

	}

	void Task::onPaused()
	{

	}

	void Task::onResumed()
	{

	}

	void Task::onDone()
	{

	}

	void Task::onInterrupted()
	{

	}

	void Task::onFinalize()
	{

	}

	Task::State Task::getState() const
	{
		return _state;
	}

	void Task::update( float dt )
	{
		onUpdate(dt);
	}

	void Task::start()
	{
		_state = Active;
		onStart();
	}

	void Task::done()
	{
		_state = Done;
		onDone();
		onFinalize();
	}

	void Task::interrupt()
	{
		_state = Interrupted;
		onInterrupted();
		onFinalize();
	}

}